package com.juzipi.common.tools;


import com.juzipi.common.constant.json.ResultCode;

public class ResultTool {


    /**
     * 默认消息和状态码
     * @return
     */
    public static Result success(){
       return new Result(true);
    }

    public static Result fail(){
        return new Result(false);
    }

    //有返回值
    public static Result successData(Object data){
        return new Result(true,data);
    }

    public static Result failData(Object data){
        return new Result(false,data);
    }

    //---------------------------------------


    /**
     * 自定义消息
     * @param resultCode
     * @param data
     * @return
     */
    //成功失败都是自定义状态码和返回值
    public static Result successCustomize(ResultCode resultCode, Object data){
        return new Result(true,resultCode,data);
    }

    public static Result failCustomize(ResultCode resultCode,Object data){
        return new Result(false,resultCode,data);
    }


    //成功失败自定义消息无返回值
    public static Result successCustomize(ResultCode resultCode){
        return new Result(true,resultCode);
    }

    public static Result failCustomize(ResultCode resultCode){
        return new Result(false,resultCode);
    }


}
